]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Fix last item check on spring animation
authorCarlos Soriano <carlos.soriano89@gmail.com>
Sat, 6 Sep 2014 10:47:33 +0000 (12:47 +0200)
committerCarlos Soriano <carlos.soriano89@gmail.com>
Sat, 6 Sep 2014 11:54:01 +0000 (13:54 +0200)
Currently we consider the last item animating being the last actor of
the list, but that's wrong since the last item animating depends on the
distance between the source actor and the original position of the
animated actor.

Take that into account to check the last item of the animation.

js/ui/iconGrid.js

index 0fc628ec2481fb150d6d3c9c0574e272f8a674a1..d90cda4a7fd0dba945f8945ee9f06c4b126bceb5 100644 (file)
@@ -521,11 +521,10 @@ const IconGrid = new Lang.Class({
             let scaleY = sourceScaledHeight / height;
             let [adjustedSourcePositionX, adjustedSourcePositionY] = [sourceCenterX - sourceScaledWidth / 2, sourceCenterY - sourceScaledHeight / 2];
 
-            // Defeat onComplete anonymous function closure
-            let isLastItem = index == actors.length - 1;
-
             let movementParams, fadeParams;
             if (animationDirection == AnimationDirection.IN) {
+                let isLastItem = actor._distance == minDist;
+
                 actorClone.opacity = 0;
                 actorClone.set_scale(scaleX, scaleY);
 
@@ -553,6 +552,8 @@ const IconGrid = new Lang.Class({
                                delay: delay,
                                opacity: 255 };
             } else {
+                let isLastItem = actor._distance == minDist;
+
                 let [startX, startY]  = actor._transformedPosition;
                 actorClone.set_position(startX, startY);